/*    */ package com.zimbra.cs.mailbox.calendar;
/*    */ 
/*    */ import java.io.PrintStream;
/*    */ import java.util.Comparator;
/*    */ import java.util.Set;
/*    */ import java.util.TimeZone;
/*    */ import java.util.TreeSet;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ListJavaTimeZones
/*    */ {
/*    */   public static void main(String[] args)
/*    */     throws Exception
/*    */   {
/* 27 */     String[] tzids = TimeZone.getAvailableIDs();
/* 28 */     Set<TimeZone> tzset = new TreeSet(new TZComparatorByOffset(null));
/* 29 */     for (String tzid : tzids) {
/* 30 */       tzset.add(TimeZone.getTimeZone(tzid));
/*    */     }
/* 32 */     for (TimeZone tz : tzset) {
/* 33 */       printTZ(tz);
/*    */     }
/*    */   }
/*    */   
/*    */   private static class TZComparatorByOffset implements Comparator<TimeZone>
/*    */   {
/*    */     public int compare(TimeZone tz1, TimeZone tz2) {
/* 40 */       if ((tz1 != null) && (tz2 != null))
/*    */       {
/* 42 */         int off1 = tz1.getRawOffset();
/* 43 */         int off2 = tz2.getRawOffset();
/* 44 */         if (off1 != off2) {
/* 45 */           return off1 - off2;
/*    */         }
/* 47 */         return tz1.getID().compareTo(tz2.getID());
/*    */       }
/* 49 */       if (tz1 != null)
/*    */       {
/* 51 */         return -1; }
/* 52 */       if (tz2 != null)
/*    */       {
/* 54 */         return 1;
/*    */       }
/*    */       
/* 57 */       return 0;
/*    */     }
/*    */   }
/*    */   
/*    */   private static String toGMTOffsetString(int offsetMillis)
/*    */   {
/* 63 */     int minutes = offsetMillis / 1000 / 60;
/*    */     String sign;
/* 65 */     String sign; if (minutes < 0) {
/* 66 */       minutes *= -1;
/* 67 */       sign = "-";
/*    */     } else {
/* 69 */       sign = "+";
/*    */     }
/* 71 */     int hours = minutes / 60;
/* 72 */     minutes %= 60;
/* 73 */     return String.format("GMT%s%02d:%02d", new Object[] { sign, Integer.valueOf(hours), Integer.valueOf(minutes) });
/*    */   }
/*    */   
/*    */   private static void printTZ(TimeZone tz) {
/* 77 */     String tzid = tz.getID();
/* 78 */     String gmtOffset = toGMTOffsetString(tz.getRawOffset());
/* 79 */     boolean isDst = tz.useDaylightTime();
/* 80 */     String clazz = tz.getClass().getSimpleName();
/* 81 */     String text = String.format("%-20s (%s) - hasDST=%s (%s:%08x)", new Object[] { tzid, gmtOffset, isDst ? "Y" : "N", clazz, Integer.valueOf(tz.hashCode()) });
/* 82 */     System.out.println(text);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailbox/calendar/ListJavaTimeZones.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */